﻿// JavaScript Document
function setPic(pic,width,height,alt){
	
	pic =  decode64(pic);
	
	writestr = "<img src='"+pic+"' ";
	if(width!=0){
		writestr+=" width="+width;
	}
	if(height!=0){
		writestr+=" height="+height;
	}
	writestr = writestr+" alt='"+alt+"' />";
	
	document.write(writestr);
}

function getpic(thispic,pic){
	
	pic =  decode64(pic);
	thispic.src = pic;
}
function tihuan()
{
	str = decode64(str);
	document.getElementById("tb_content").innerHTML = str;

}
function clickurl(urlid){
	urlid =  decode64(urlid);
	window.open(urlid);
	//location.href=urlid;
	
}

function checkLogin(session){//session为1记录登陆状态
    var ddusername=$('#loginuser').val();
	var dduserpwd=$('#loginpwd').val();
	var jump_href=$('#jump_href').attr('href');
	if(ddusername=='' || dduserpwd==''){
	    alert('用户名或密码不能为空');
	}
	else{
	    $.post('ajax.php?fun=checkLogin', {'ddusername':ddusername,'dduserpwd':dduserpwd,'session':session}, function(data){
		    if(data>0){
				//$('.jumpbox').hide();
				//location.replace(location.href);
			    window.location.href=jump_href;
		    }
			else{
			    alert('账号密码错误');
			}
	    });
	}
}

function parse_url(url){
 var pattern = /(\w+)=(\w+)/ig;
 var parames = {};
 url.replace(pattern, function(a, b, c){
  parames[b] = c;
 });
 return parames;
}

function AddFavorite(sURL, sTitle){
 try{
  window.external.addFavorite(sURL, sTitle);
  }
 catch (e){
  try{
   window.sidebar.addPanel(sTitle, sURL, "");
   }
  catch (e)
  {
   alert("加入收藏失败，您的浏览器不允许，请使用Ctrl+D进行添加");
  }
 }
}